import DecorationIndex from './decorationIndex'
import HouseDecList from './list'//  装修列表


const rentDecoRouter = {

  path: 'landlord/houseDecoration',
  getChildRoutes(location, cb) {
    require.ensure([], (require) => {
      cb(null, [
        {
          path: 'list',
          getComponents(nextState, cb) {
            require.ensure([], function (require) {
              cb(null, require('./list'))
            })
          },

        },
        {
          path: 'addRoom',
          getComponents(nextState, cb) {
            require.ensure([], function (require) {
              cb(null, require('./addRoom'))
            })
          }
        },
        {
          path: 'historicalCost',
          getComponents(nextState, cb) {
            require.ensure([], function (require) {
              cb(null, require('./historicalCost'))
            })
          }
        },
        {
          path: 'cost',
          getComponents(nextState, cb) {
            require.ensure([], function (require) {
              cb(null, require('./houseCost'))
            })
          }
        },
        {
          path: 'roomCost',
          getComponents(nextState, cb) {
            require.ensure([], function (require) {
              cb(null, require('./roomCost'))
            })
          }
        },
        {
          path: 'roomModify',
          getComponents(nextState, cb) {
            require.ensure([], function (require) {
              cb(null, require('./roomModify'))
            })
          }
        },
        chargeRouter
      ])
    })
  },

  indexRoute: {
    getComponents(location, cb) {
      require.ensure([], function (require) {
        cb(null, HouseDecList)
      })
      return cb()
    }
  },

  getComponents(nextState, cb) {
    require.ensure([], (require) => {
      cb(null, DecorationIndex)
    })
  }
}

const chargeRouter = {

  path: 'chargeManage',
  getChildRoutes(location, cb) {
    require.ensure([], (require) => {
      cb(null, [
        {
          path: 'chargeList',
          getComponents(nextState, cb) {
            require.ensure([], function (require) {
              cb(null, require('./chargeManage/list'))
            })
          }
        },
        {
          path: 'chargeAdd',
          getComponents(nextState, cb) {
            require.ensure([], function (require) {
              cb(null, require('./chargeManage/add'))
            })
          }
        }
      ])
    })
  },
  indexRoute: {
    getComponents(location, cb) {
      require.ensure([], function (require) {
        cb(null, require('./chargeManage/list'))
      })
      return cb()
    }
  },

  getComponents(nextState, cb) {
    require.ensure([], (require) => {
      cb(null, require('./chargeManage/chargeIndex'))
    })
  }

}

export default rentDecoRouter;

